package com.iflytek.config;

import com.iflytek.interceptor.FirstInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置类
//@Configuration
//实现WebMvcConfigurer的配置类，是SpringMVC的配置类
public class WebConfig implements WebMvcConfigurer {

	//此方法可以将新的拦截器添加到SpringMVC框架中
	public void addInterceptors(InterceptorRegistry registry){
    	registry.addInterceptor(new FirstInterceptor())      //添加拦截器到拦截器链
                .addPathPatterns("/**")					     //指定该拦截器拦截哪些访问
				.excludePathPatterns("/login")
                .excludePathPatterns("/css/**");              //排除部分访问路径不拦截
    	
    }
}